package com.relational.mapping.Service.Impl;

import com.relational.mapping.Model.Comment;
import com.relational.mapping.Repository.CommentRepository;
import com.relational.mapping.Service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Csea
 * @title
 * @date 2019/6/10 21:06
 */
@Service
public class CommentServiceImpl implements CommentService {
    @Autowired
    private CommentRepository repository;

    @Override
    public Comment save(Comment comment) {
        return repository.save(comment);
    }

    @Override
    public Comment findById(Integer commentId) {
        return repository.findById(commentId).orElse(null);
    }

    @Override
    public void deleteById(Integer commentId) {
        repository.deleteById(commentId);
    }
}
